(function (global, factory) {
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  typeof define === 'function' && define.amd ? define(['hy5b/math/index', 'jquery', './index'], factory) :
  factory(math, $);
}(this, function (util, $) { 'use strict';

  $.defineGd2d({ //hline是一根圆圈线
    name: 'drawHLine',
    props: {
      radius: 60,
      lineWidth: 10,
      angleStart: 270,
      angleEnd: 90,
      shadowBlur: 5,
      rotation: 0
    },
    fn: function(ctx, p) {
      var gradient = ctx.createLinearGradient(0, - p.radius, 0, p.radius);
      gradient.addColorStop(0, 'rgba(255, 51, 102, 1)');
      gradient.addColorStop(1, 'rgba(255, 51, 102, 0)');

      ctx.save();
      ctx.beginPath();
      ctx.translate(p.x, p.y);
      ctx.rotate(util.degree2radian(p.rotation)); //变换要放在前面
      ctx.arc(0, 0, p.radius, util.degree2radian(p.angleStart), util.degree2radian(p.angleEnd), true);
      ctx.lineWidth = p.lineWidth;
      ctx.strokeStyle = gradient;
      ctx.shadowColor = 'rgba(242, 162, 192, 0.3)';
      ctx.shadowBlur = p.shadowBlur;
      ctx.lineCap = 'round';
      ctx.stroke();
      ctx.closePath();
      ctx.restore();
    }
  });
  return $.defineGd2d;

}))